/*    */ package com.hp.bon.sgw.core.processor;
/*    */ 
/*    */ import com.hp.bon.security.bean.HandleResult;
/*    */ import com.hp.bon.security.config.SecurityConfigManager;
/*    */ import com.hp.bon.sgw.core.CallParam;
/*    */ import com.hp.bon.sgw.core.channel.handler.IAsynCallHandler;
/*    */ import com.hp.bon.sgw.util.dcc.DccAvpHelper;
/*    */ import com.hp.ocs.diameter.message.AVP_Unsigned32;
/*    */ import com.hp.ocs.diameter.message.Message;
/*    */ import com.hp.ocs.diameter.message.MessageDictionary;
/*    */ import org.slf4j.Logger;
/*    */ 
/*    */ public class BonConfSyncProcessor extends Processor
/*    */ {
/*    */   public int process(CallParam callParam)
/*    */   {
/* 26 */     Message request = (Message)callParam.getRequest();
/*    */ 
/* 28 */     Message answer = new Message();
/* 29 */     answer.prepareResponse(request);
/* 30 */     MessageDictionary md = request.getDictionary();
/* 31 */     md.prepareResponseAVP(answer);
/*    */ 
/* 33 */     HandleResult hr = SecurityConfigManager.getInstance().handleConfCCR(request);
/*    */ 
/* 35 */     com.hp.bon.sgw.Constants.LOG.info("handle " + callParam.getServiceContextId() + " message(CCR), sessionId:" + callParam.getSessionId());
/* 36 */     if (hr.getResultCode().intValue() == 0) {
/* 37 */       com.hp.bon.sgw.Constants.LOG.info("handle " + callParam.getSessionId() + " success");
/* 38 */       answer.add(new AVP_Unsigned32(268, 2001));
/* 39 */       answer.add(DccAvpHelper.genDefaultServiceResultAVP(hr.getResultCode().intValue()));
/*    */     } else {
/* 41 */       com.hp.bon.sgw.Constants.LOG.warn("handle " + callParam.getSessionId() + " failed, error code:" + hr.getResultCode());
/* 42 */       if (hr.getResultCode().intValue() >= 10100) {
/* 43 */         answer.add(new AVP_Unsigned32(268, 2001));
/* 44 */         answer.add(DccAvpHelper.genDefaultServiceResultAVP(hr.getResultCode().intValue()));
/*    */       } else {
/* 46 */         answer.add(new AVP_Unsigned32(268, callParam.getRetCode()));
/*    */       }
/*    */     }
/* 49 */     callParam.setResponse(answer);
/* 50 */     callParam.getAsynHandler().onCallResult(callParam);
/* 51 */     return 0;
/*    */   }
/*    */ 
/*    */   public int endProcess(CallParam callParam)
/*    */   {
/* 57 */     if (callParam.getRecvResponse() != null) {
/* 58 */       com.hp.bon.sgw.Constants.LOG.info("handle " + callParam.getServiceContextId() + " message(CCA), sessionId:" + callParam.getSessionId());
/* 59 */       if (callParam.getServiceContextId().startsWith(com.hp.bon.security.Constants.BonConfSyncCapabilityPrefix)) {
/* 60 */         int resultCode = SecurityConfigManager.getInstance().handleConfCCA((Message)callParam.getRecvResponse(), (Message)callParam.getRequest());
/* 61 */         if (resultCode == 0)
/* 62 */           com.hp.bon.sgw.Constants.LOG.info("handle " + callParam.getSessionId() + " success");
/*    */         else
/* 64 */           com.hp.bon.sgw.Constants.LOG.warn("handle " + callParam.getSessionId() + " failed, error code:" + resultCode);
/*    */       }
/*    */     }
/*    */     else {
/* 68 */       com.hp.bon.sgw.Constants.LOG.warn(callParam.getSessionId() + " no response received.");
/*    */     }
/* 70 */     return 0;
/*    */   }
/*    */ }

/* Location:           C:\Users\think\Desktop\sgw_2.1.jar
 * Qualified Name:     com.hp.bon.sgw.core.processor.BonConfSyncProcessor
 * JD-Core Version:    0.6.1
 */